import { IPSAppMsgTempl } from './ipsapp-msg-templ';
import { IPSLanguageRes } from '../../res/ipslanguage-res';
import { IPSSystemModule } from '../../system/ipssystem-module';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSAppMsgTemplImpl extends PSModelObjectImpl implements IPSAppMsgTempl {
  get codeName(): string {
    return this.M.codeName;
  }

  get content(): string {
    return this.M.content;
  }

  protected contentpslanguageres: IPSLanguageRes | null = null;

  getContentPSLanguageRes(): IPSLanguageRes | null {
    if (this.contentpslanguageres != null) return this.contentpslanguageres;
    const value = this.M.getContentPSLanguageRes;
    if (value == null) {
      return null;
    }
    this.contentpslanguageres = this.getPSModel4('res.IPSLanguageRes', value, 'getContentPSLanguageRes') as IPSLanguageRes;
    return this.contentpslanguageres;
  }

  get contentPSLanguageRes(): IPSLanguageRes | null {
    return this.getContentPSLanguageRes();
  }

  getContentPSLanguageResMust(): IPSLanguageRes {
    const value = this.getContentPSLanguageRes();
    if (value == null) {
      throw new Error('未指定内容多语言资源对象');
    }
    return value;
  }

  get contentType(): 'TEXT' | 'HTML' | 'JSON' | 'PROPERTIES' | 'USER' | 'USER2' | 'USER3' | 'USER4' {
    return this.M.contentType;
  }

  get dDContent(): string {
    return this.M.dDContent;
  }

  protected ddpslanguageres: IPSLanguageRes | null = null;

  getDDPSLanguageRes(): IPSLanguageRes | null {
    if (this.ddpslanguageres != null) return this.ddpslanguageres;
    const value = this.M.getDDPSLanguageRes;
    if (value == null) {
      return null;
    }
    this.ddpslanguageres = this.getPSModel4('res.IPSLanguageRes', value, 'getDDPSLanguageRes') as IPSLanguageRes;
    return this.ddpslanguageres;
  }

  get dDPSLanguageRes(): IPSLanguageRes | null {
    return this.getDDPSLanguageRes();
  }

  getDDPSLanguageResMust(): IPSLanguageRes {
    const value = this.getDDPSLanguageRes();
    if (value == null) {
      throw new Error('未指定钉钉内容多语言资源对象');
    }
    return value;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get iMContent(): string {
    return this.M.iMContent;
  }

  protected impslanguageres: IPSLanguageRes | null = null;

  getIMPSLanguageRes(): IPSLanguageRes | null {
    if (this.impslanguageres != null) return this.impslanguageres;
    const value = this.M.getIMPSLanguageRes;
    if (value == null) {
      return null;
    }
    this.impslanguageres = this.getPSModel4('res.IPSLanguageRes', value, 'getIMPSLanguageRes') as IPSLanguageRes;
    return this.impslanguageres;
  }

  get iMPSLanguageRes(): IPSLanguageRes | null {
    return this.getIMPSLanguageRes();
  }

  getIMPSLanguageResMust(): IPSLanguageRes {
    const value = this.getIMPSLanguageRes();
    if (value == null) {
      throw new Error('未指定即时消息多语言资源对象');
    }
    return value;
  }

  get memo(): string {
    return this.M.memo;
  }

  get mobTaskUrl(): string {
    return this.M.mobTaskUrl;
  }

  get name(): string {
    return this.M.name;
  }

  get orderValue(): number {
    return this.M.orderValue != null ? this.M.orderValue : 99999;
  }

  protected pssystemmodule: IPSSystemModule | null = null;

  getPSSystemModule(): IPSSystemModule | null {
    if (this.pssystemmodule != null) return this.pssystemmodule;
    const value = this.M.getPSSystemModule;
    if (value == null) {
      return null;
    }
    this.pssystemmodule = this.getPSModel4('system.IPSSystemModule', value, 'getPSSystemModule') as IPSSystemModule;
    return this.pssystemmodule;
  }

  get psSystemModule(): IPSSystemModule | null {
    return this.getPSSystemModule();
  }

  getPSSystemModuleMust(): IPSSystemModule {
    const value = this.getPSSystemModule();
    if (value == null) {
      throw new Error('未指定系统模块');
    }
    return value;
  }

  get sMSContent(): string {
    return this.M.sMSContent;
  }

  protected smspslanguageres: IPSLanguageRes | null = null;

  getSMSPSLanguageRes(): IPSLanguageRes | null {
    if (this.smspslanguageres != null) return this.smspslanguageres;
    const value = this.M.getSMSPSLanguageRes;
    if (value == null) {
      return null;
    }
    this.smspslanguageres = this.getPSModel4('res.IPSLanguageRes', value, 'getSMSPSLanguageRes') as IPSLanguageRes;
    return this.smspslanguageres;
  }

  get sMSPSLanguageRes(): IPSLanguageRes | null {
    return this.getSMSPSLanguageRes();
  }

  getSMSPSLanguageResMust(): IPSLanguageRes {
    const value = this.getSMSPSLanguageRes();
    if (value == null) {
      throw new Error('未指定短消息多语言资源对象');
    }
    return value;
  }

  protected subpslanguageres: IPSLanguageRes | null = null;

  getSubPSLanguageRes(): IPSLanguageRes | null {
    if (this.subpslanguageres != null) return this.subpslanguageres;
    const value = this.M.getSubPSLanguageRes;
    if (value == null) {
      return null;
    }
    this.subpslanguageres = this.getPSModel4('res.IPSLanguageRes', value, 'getSubPSLanguageRes') as IPSLanguageRes;
    return this.subpslanguageres;
  }

  get subPSLanguageRes(): IPSLanguageRes | null {
    return this.getSubPSLanguageRes();
  }

  getSubPSLanguageResMust(): IPSLanguageRes {
    const value = this.getSubPSLanguageRes();
    if (value == null) {
      throw new Error('未指定标题多语言资源对象');
    }
    return value;
  }

  get subject(): string {
    return this.M.subject;
  }

  get taskUrl(): string {
    return this.M.taskUrl;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get wXContent(): string {
    return this.M.wXContent;
  }

  protected wxpslanguageres: IPSLanguageRes | null = null;

  getWXPSLanguageRes(): IPSLanguageRes | null {
    if (this.wxpslanguageres != null) return this.wxpslanguageres;
    const value = this.M.getWXPSLanguageRes;
    if (value == null) {
      return null;
    }
    this.wxpslanguageres = this.getPSModel4('res.IPSLanguageRes', value, 'getWXPSLanguageRes') as IPSLanguageRes;
    return this.wxpslanguageres;
  }

  get wXPSLanguageRes(): IPSLanguageRes | null {
    return this.getWXPSLanguageRes();
  }

  getWXPSLanguageResMust(): IPSLanguageRes {
    const value = this.getWXPSLanguageRes();
    if (value == null) {
      throw new Error('未指定微信内容多语言资源对象');
    }
    return value;
  }

  get mailGroupSend(): boolean {
    return this.M.mailGroupSend;
  }

  get cls(): string {
    return 'PSAppMsgTemplImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'IPSModelSortable' || cls == 'app.msg.IPSAppMsgTempl' || cls == 'msg.IPSSysMsgTempl') return true;
    return super.instanceof(cls);
  }
}
